<?php 
if($_REQUEST['cat'] > 0)
{ $items = getMenuTypes($_REQUEST['cat']); }
else
{ 
	if($_REQUEST['type'] > 0)
	{ $items = getMenuTypes(0, 0, 0, $_REQUEST['type']); }
	else
	{ $items = getMenuTypes(); }
}
?>
<div class="menu_top">
	<input type="hidden" name="action" value="new_item">
	<input type="submit" value="Add new menu type" class="buttons" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/new.gif'); border:1px solid #DDDDDD;" />&nbsp;&nbsp;
	Title:&nbsp;&nbsp;<input name="name" type="text" value="" maxlength="99">
	<input type="submit" value="Save" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/save.gif'); border:1px solid #DDDDDD; height:20px;" class="buttons">
    <input type="button" onmousedown="document.getElementById('load_css').value=7; submit();" value="Reload MenuTypes Css" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/process.gif'); border:1px solid #DDDDDD; height:20px;" 
        class="buttons">
        <input type="hidden" id="load_css" name="load_css" value="0" />
        
</div>
<div class="menu_list">
<table id="menulist" class="item_list" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<th nowrap="nowrap">#&nbsp;ID&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Title&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Type&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Levels&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Position&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Active&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Edit&nbsp;&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Delete&nbsp;&nbsp;&nbsp;</th>
	</tr>
	<?php 
	if($items):
	foreach($items as $item)
	{
	?>
	<tr class="items">
		<td nowrap="nowrap">#&nbsp;<input type="hidden" name="menutype_id[]" value="<?php echo $item['id']; ?>" /><?php echo $item['id']; ?></td>
		<td nowrap="nowrap"><input style="width:100px;" class="inp_txt" name="menutype_name[]" type="text" value="<?php echo $item['name']; ?>" maxlength="90" /></td>
        <td nowrap="nowrap">
			<select name="menutype_type[]" style="width:160px;" onChange="submit();">
            	<option value="0" <?php if($item['type'] == 0) { echo 'selected'; } ?>>Horisontal (CSS)</option>
                <option value="2" <?php if($item['type'] == 2) { echo 'selected'; } ?>>Horisontal Dropdown (CSS-JS)</option>
                <option value="4" <?php if($item['type'] == 4) { echo 'selected'; } ?>>Horisontal Double (CSS-JS)</option>
                <option value="1" <?php if($item['type'] == 1) { echo 'selected'; } ?>>Vertical (CSS)</option>
                <option value="3" <?php if($item['type'] == 3) { echo 'selected'; } ?>>Vertical Dropdown (CSS-JS)</option>
			</select>
		</td>
		<td nowrap="nowrap">
			<select disabled="disabled" name="menutype_levels[]" style="width:64px;" onChange="submit();">
				<?php 
					$i=1;
					while($i <= 10)
					{
						if ($i == $item['levels'])
						{ echo '<option value="'.$i.'" selected="selected">'.$i.'</option>'; }
						else
						{ echo '<option value="'.$i.'">'.$i.'</option>'; }
						$i ++;
					}
				?>
			</select>
		</td>
        <td nowrap="nowrap">
			<select name="menutype_position[]" style="width:70px;" onChange="submit();">
				<option value="0" <?php if($item['position'] == 0) { echo 'selected'; } ?>>First</option>
                <option value="1" <?php if($item['position'] == 1) { echo 'selected'; } ?>>Any (Mid)</option>
                <option value="2" <?php if($item['position'] == 2) { echo 'selected'; } ?>>Last</option>
			</select>
		</td>
		<td nowrap="nowrap">
			<?php if($item['active'] == 0): ?>
			<img src="../images/system/active_<?php echo $item['active']; ?>_25.gif" alt="activate" onmousedown="document.getElementById('activate').value='<?php echo $item['id']; ?>';" onmouseup="edit_form.submit();" />
			<?php else: ?>
			<img src="../images/system/active_<?php echo $item['active']; ?>_25.gif" alt="deactivate" onmousedown="document.getElementById('deactivate').value='<?php echo $item['id']; ?>';" onmouseup="edit_form.submit();" />
			<?php endif; ?>
		</td>
		<td nowrap="nowrap">
			<a href="?con=<?php echo $_REQUEST['con']; ?>&item=<?php echo $item['id']; ?>"><img src="../images/system/templ.gif" border="0" /></a>&nbsp;
		</td>
		<td nowrap="nowrap"><input class="inp_image" type="image" name="delete_menutype" src="../images/system/trash_25.gif" value="0" onclick="this.value='<?php echo $item['id']; ?>'; edit_form.submit();" /></td>
		<td style="overflow:hidden;">
            <?php //echo getMenuTypesHTML($item['id'], $menutypes_params); ?>
            <div class="com_menus type_<?php echo $item['type']; ?>">
                <div class="cm_<?php echo $item['id']; ?>">
                    <ul> 
                        <li class="level_0"><a class="level_0 first" href="#"><h2><span><div>Home</div></span></h2></a></li> 
                        <li class="level_0"><a class="level_0 active" href="#"><h2><span><div>About (Active)</div></span></h2></a></li> 
                    </ul>
                </div>
            </div>
		</td>
	</tr>
	<?php
	}
	?>
</table>
<input type="hidden" id="activate" name="activate" value="0" />
<input type="hidden" id="deactivate" name="deactivate" value="0" />
</div>
<?php endif; ?>